﻿// <copyright file="Geometry3D.cs" company="Axelerate Solutions S.A.">
// Copyright (c) Axelerate Solutions S.A.  All rights reserved.
// </copyright>

namespace Axelerate.Silverlight3D.Media.Media3D
{
    using System;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using System.Collections.Generic;
    using Axelerate.Silverlight3D.Controls;

    /// <summary>
    /// File name: Geometry3D.cs
    /// Company: Axelerate Solutions S.A.
    /// Created By: Daniel Rojas
    /// Created Date: 10/06/2008 16:30:40 h.
    /// Description: Classes that derive from this abstract base class define 3D geometric shapes. The Geometry3D class of objects can be used for hit-testing and rendering 3D graphic data.
    ///   <Modifications>
    ///   </Modifications>
    /// </summary>
    /// <remarks>A Geometry3D by itself has no appearance. To render a Geometry3D, use a GeometryModel3D to combine the Geometry3D with a Material.
    /// MeshGeometry3D is the concrete instance of a Geometry3D. To render a 3D shape, compose a GeometryModel3D by specifying a MeshGeometry3D and a Material.
    /// </remarks>
    public abstract class Geometry3D : Freezable
    {
        #region Fields
        /// <summary>
        /// True if the internal values of Geometry3D Changed
        /// </summary>
        protected bool mIsDirty = false;
        #endregion

        /// <summary>
        /// Create a instance of the Geometry3D. This is protected to avoid use this class directly.
        /// </summary>
        protected Geometry3D()
        {
        }

        #region Properties
        
        public abstract Rect3D Bounds { get; }

        protected override void OnChanged()
        {
            mIsDirty = true;
            base.OnChanged();            
        }
        #endregion

        /// <summary>
        /// Retrieve the collection of the renderentities for this geometry model.
        /// </summary>
        internal abstract List<RenderEntity> RenderEntenties { get; }

        /// <summary>
        /// Create the render entities for this geometry
        /// </summary>
        /// <param name="entityPool">entity render pool of entities.</param>
        /// <param name="material">Material to use for the faces</param>
        /// <param name="backMaterial">Back material of the faces</param>
        internal abstract void CreateRenderEntities(RenderEntityPool entityPool, Material material, Material backMaterial);
    }
}
